<?php

/**
 * Created by PhpStorm.
 * User: mhx
 * Date: 17-3-2
 * Time: 下午3:54
 */
class BaseModel
{
    protected $host;
    protected $username;
    protected $passwd;
    function __construct(){
        $this->host = '127.0.0.1';
        $this->username = 'root';
        $this->passwd = 'root';
        $this->connect();
    }
    protected function connect(){
        $link = mysqli_connect($this->host,$this->username,$this->passwd);
        if($link) {
            mysqli_select_db('Mhx_test');
            mysqli_query("set names 'utf-8'");
        }else{
            echo '数据库连接失败';
        }
    }

}